package com.fbli.test.common.result;

public class ResultSend {

    private ResultSend(){

    }

    private static final int SUCCESS_CODE = 0;
    private static final String SUCCESS_MSG = "操作成功！";

    private static final int FAIL_CODE = 1;
    private static final String FAIL_MSG = "操作失败！";

    public static ResultParam send(){
        ResultParam resultParam = new ResultParam();
        resultParam.setCode(SUCCESS_CODE);
        resultParam.setMsg(SUCCESS_MSG);
        resultParam.setData(null);
        return resultParam;
    }

    public static ResultParam send(int code, String msg, Object data){
        ResultParam resultParam = new ResultParam();
        resultParam.setCode(code);
        resultParam.setMsg(msg);
        resultParam.setData(data);
        return resultParam;
    }

    public static ResultParam success(Object data){
        ResultParam resultParam = new ResultParam();
        resultParam.setCode(SUCCESS_CODE);
        resultParam.setMsg(SUCCESS_MSG);
        resultParam.setData(data);
        return resultParam;
    }

    public static ResultParam fail(Object data){
        ResultParam resultParam = new ResultParam();
        resultParam.setCode(FAIL_CODE);
        resultParam.setMsg(FAIL_MSG);
        resultParam.setData(data);
        return resultParam;
    }

}
